<template>
    <div>
        <div>
            <van-row>
                <van-col span="24">
                    <van-icon id="fanhui" @click="tuichu()" name="cross" />
                </van-col>
            </van-row>

            <div v-for="u in shopping">
                <van-row>
                    <van-col span="24">
                        <van-card
                                @click="jinru(u.shoppingname,u.shoppingimg,u.shoppingpricenow,u.id)"
                                :num="u.shoppingcount"
                                :price="u.shoppingpricenow"
                                :title="u.shoppingname"
                                :thumb="u.shoppingimg"
                                :origin-price="u.shoppingprice"
                        />
                    </van-col>
                </van-row>
            </div>

        </div>


    </div>
</template>

<script>
    export default {
        name: "Shopping",
        data(){
            return{
                shopping:[]
            }
        },
        mounted(){
            var that = this
            var user=this.$route.query.user

            this.axios.post("http://localhost:8081/api/shopping/all.do",{
                "shoppinguser":user,
            })
                .then(function (response) {
                    console.log(response.data)
                    //response.data 等同于R
                    that.shopping=response.data.data;
                })

        },
        methods:{
            tuichu(){
                history.back();
            },
            jinru(x,y,z,k){
                this.$router.push({path:"/shoppingdetali",query:{shoppingnames:x,shoppingimg:y,shoppingpricenow:z,ids:k}})
            }
        }
    }
</script>

<style scoped>

    #fanhui{
        top:0;
        left: 20px;
    }
</style>